package com.bjpowernode.java;

public class Student {
    private String name;
    private float chinese;
    private float math;

    public Student() {
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setChinese(int chinese) {
        this.chinese = chinese;
    }

    public void setMath(int math) {
        this.math = math;
    }

    public float avg(){
        float avg = (chinese+math)/2;
        return avg;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", chinese=" + chinese +
                ", math=" + math +
                '}';
    }
}

class Test1{
    public static void main(String[] args) {
        Student student = new Student();
        student.setName("张三");
        student.setChinese(81);
        student.setMath(70);
        System.out.println(student.avg());
        System.out.println(student);
    }
}
